﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace QuanLyThuNgan
{
    public class DMLoaiDichVuDAO
    {
        public bool m_Insert(DMLoaiDichVuDTO _info)
        {
            int _guidi = 0;
            if (_info.BGuiDi == true)
                _guidi = 1;
            string _sql = string.Format("exec usp_ThuNgan_DMLoaiDichVu_Insert '{0}',N'{1}','{2}',{3},N'{4}'", _info.SLoaidvu, _info.STenloai, _info.SMadv, _guidi, _info.STenLoaiDichVu);
            return Uit.it_SQL.ExecuteNonQuery(_sql, false);
        }

        public bool m_Update(DMLoaiDichVuDTO _info)
        {
            int _guidi = 0;
            if (_info.BGuiDi == true)
                _guidi = 1;
            string _sql = string.Format("exec usp_ThuNgan_DMLoaiDichVu_Update '{0}',N'{1}','{2}',{3},N'{4}'", _info.SLoaidvu, _info.STenloai, _info.SMadv, _guidi, _info.STenLoaiDichVu);
            return Uit.it_SQL.ExecuteNonQuery(_sql, false);
        }
        public bool m_Delete(DMLoaiDichVuDTO _info)
        {
            string _sql = string.Format("exec usp_ThuNgan_DMLoaiDichVu_Delete '{0}'", _info.SLoaidvu);
            return Uit.it_SQL.ExecuteNonQuery(_sql, false);
        }

        public DataTable m_SelectAllLoaiDichVu()
        {
            string _sql = string.Format("usp_ThuNgan_DMLoaiDichVu_SelectAll");
            return Uit.it_SQL.getDataTable(_sql, null, "");
        }

        public DataTable m_SelectDMDonVi()
        {
            string _sql = string.Format("usp_ThuNgan_DMDonVi_SelectAll");
            return Uit.it_SQL.getDataTable(_sql, null, "");
        }

        public DataTable m_SelectDMLoaiDV()
        {
            string _sql = string.Format("usp_ThuNgan_DMLoaiDichVu_SelectTenDV");
            return Uit.it_SQL.getDataTable(_sql, null, "");
        }

        public DataTable m_SelectNhomDV()
        {
            string _sql = string.Format("usp_ThuNgan_DMLoaiDichVu_SelectNhomDV");
            return Uit.it_SQL.getDataTable(_sql, null, "");
        }
    }
}
